package javaBase.javaException;

/**
 * Created by Administrator on 2017/2/23 0023.
 */
public class MyException extends Exception {
    public MyException() {
    }

    public MyException(String message) {
        super(message);
    }

    public MyException(String message, Exception e) {
        super(message, e);
    }

    public static void main(String[] args) {
        int i = 0;
        String greetings[] = {" Hello world !", " Hello World !! ",
                " HELLO WORLD !!!"};

        while (i < 4) {
            System.out.println(i);
            try {
                // 特别注意循环控制变量i的设计，避免造成无限循环
                System.out.println(greetings[i++]);

            } catch (ArrayIndexOutOfBoundsException e) {
                System.out.println("数组下标越界异常");
            } finally {
                System.out.println("--------------------------");
            }
        }
    }
}
